package com.es.esdemo.tool;

import com.es.esdemo.entity.Resp;
import lombok.Data;

/**
 * @description
 * @author yanghanwei[yanghanwei@bjpp.com]
 * @date 19:41 2020-11-30
 */
@Data
public class RespTool {

    public static Resp buildSuccess(Object data){
        Resp resp = new Resp();
        resp.setDate(data);
        resp.setCode(200);
        resp.setMsg("success");
        return resp;
    }

    public static Resp buildFail(Integer code, String msg){
        Resp resp = new Resp();
        resp.setCode(code);
        resp.setMsg(msg);
        return resp;
    }

    public static Resp buildResp(Integer code, String msg, Object data){
        Resp resp = new Resp();
        resp.setCode(code);
        resp.setMsg(msg);
        resp.setDate(data);
        return resp;
    }
}
